<include file="Public:header" />

<div class="container no-mar-top no-bg">
	<div class="row " >
		<div class="span2 bs-docs-sidebar mar-left3" >
			<ul class="nav nav-list bs-docs-sidenav span2 widths" id="left_list" style="min-height:410px;">
				<li class="first-li"><span class="spans1"><img src="__PUBLIC__/img/house.png"/>&nbsp;商机详情</span></li>
				<li class="active" ><a href="#tab1">{:L('BASIC_INFORMATION')}</a></li>
				<li><a href="#tab8">{:L('PROMOTE_THE_HISTORY')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$status_counts">{$status_counts}</if></span></a></li>
				<li><a href="#tab3">{:L('COMMUNICATION_LOGS')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$business['log_count']">{$business['log_count']}</if></span></a></li>
				<li><a href="#tab7">{:L('CONTRACT')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$business['contract_count']">{$business['contract_count']}</if></span></a></li>
				<!-- <li><a href="#tab2">{:L('PRODUCT')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$business['product_count']">{$business['product_count']}</if></span></a></li> -->
				<li><a href="#tab4">{:L('TASK')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$business['task_count']">{$business['task_count']}</if></span></a></li>
				<li><a href="#tab5">{:L('SCHEDULE')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$business['event_count']">{$business['event_count']}</if></span></a></li>
				<li><a href="#tab6">{:L('ATTACHMENT')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$business['file_count']">{$business['file_count']}</if></span></a></li>
			</ul>
		</div>
		<div class="tab-content span8 mar-lefts" >
			<div class="tab-pane fade in active" id="tab1">
				<div class="container2 top-pad" >
					<a class="basic_information" name="tab">{:L('BASIC_INFORMATION')}</a>
					<div class="pull-right"style="margin:-3px 15px 0 0;">
						<a href="{:U('business/edit', 'id='.$business['business_id'])}" class="btn btn-primary">{:L('EDIT')}</a>
						<a href="{:U('business/delete', 'id='.$business['business_id'])}" class="btn btn-primary del_confirm">{:L('DELETE')}</a>
						<a href="javascript:void(0)" class="btn btn-primary" onclick="javascript:history.go(-1)">{:L('RETURN')}</a>
					</div>
				</div>
				<div class="back_box container3 mar-top">
					<include file="Public:alert"/>
					<table class="table table-hover">
						<tbody>
							<tr><th colspan="4">{:L('BASIC_INFORMATION')}</th></tr>
							<if condition="$business['is_deleted'] eq 1">
								<tr>
									<td class="tdleft">{:L('DELETE_THE_PEOPLE')}</td>
									<td><a class="role_info" href="javascript:void(0)" rel="{$business.deleted.role_id}">{$business.deleted.user_name}</a></td>
									<td class="tdleft" width="15%">{:L('DELETE_THE_TIME')}</td>
									<td>{$business.delete_time|date='Y-m-d H:i:s',###}</td>
								</tr>
							</if>
							<tr>
								<td class="tdleft">{:L('PRINCIPAL')}</td>
								<td><a class="role_info" href="javascript:void(0)" rel="{$business.owner.role_id}">{$business.owner.user_name}</if></a></td>
								<td class="tdleft" width="15%">{:L('CREATION_TIME')}</td>
								<td><if condition="$business['create_time'] neq 0">{$business.create_time|date='Y-m-d H:i:s',###}</if></td>
							</tr>
							<tr>
								<td class="tdleft" width="15%">{:L('THE_ADVANCE_OF_TIME')}</td>
								<td><if condition="$business['update_time'] neq 0">{$business.update_time|date='Y-m-d H:i:s',###}<else />{:L('NOT_AVAILABLE')}</if></td>
							<php>$j=0;</php>
							<volist name="field_list" id="vo">
							<php>$j++;</php>
							<if condition="$vo['form_type'] == 'textarea' or $vo['form_type'] == 'editor'">
								<if condition="$i%2 != 0">
								<td colspan="2">&nbsp;</td>
								</tr>
								</if>
								<tr>
									<td class="tdleft" width="15%">{$vo.name}:</td>
									<td colspan="3" style="word-break:break-word;">{$business[$vo['field']]}</td>
								</tr>
								<if condition="$i%2 == 0 && count($field_list) != $j">
								<php>$i++;</php>
								</if>
							<else/>
								<if condition="$i%2 == 0">
								<tr>
								</if>
									<td class="tdleft" width="15%">{$vo.name}:</td>
									<td width="35%">
										<span style="color:#{$vo['color']}">
										<if condition="$vo['form_type'] eq 'datetime'">
											<if condition="$business[$vo['field']] gt 0">{$business[$vo['field']]|date='Y-m-d',###}</if>
										<elseif condition="$vo['field'] eq 'customer_id'"/>
											<a href="{:U('customer/view','id='.$business['customer_id'])}">{$business['customer']['name']}</a>
										<elseif condition="$vo['field'] eq 'contacts_id'"/>
											{$business['contacts']['name']}
										<elseif  condition="$business[$vo['field']]"/>
											{$business[$vo['field']]}
										</if>
										</span>
									</td>
								<if condition="$i%2 != 0">
								</tr>
								</if>
								<if condition="$i%2 == 0 && count($field_list) == $j">
									<td colspan="2">&nbsp;</td>
								</tr>
								</if>
							</if>
							</volist>
						</tbody>
					</table>
					<!-- 产品 -->
					<div class="header1">
						<div class="pull-left two-title" style="margin:15px 0; ">
							{:L('RELATED_PRODUCTS')}
							<span class="badge badge-success"><if condition="$business['product_count']">{$business['product_count']}</if></span>
						</div>
					</div>

					<table class="table table-bordered" id="no-input-border" width="95%" border="0" cellspacing="1" cellpadding="0">
						<thead>
							<tr style="background-color:#E0E8FF;text-align:center;">
								<td class="span2">产品</td>
								<td>数量</td>
								<td>单价</td>
								<td>折扣率(%)</td>
								<td>税率(%)</td>
								<td>小计</td>
								<td class="span2">备注</td>
							</tr>
						</thead>
						
						<tbody>
							<volist name="business.product" id="vo">
								<input type="hidden" name="product[{$key+1}][r_id]" value="{$vo.id}"/>
								<tr id="row_{$key+1}">
									<td>
										{$vo.info.name}
									</td>
									<td>
										{$vo.amount}
									</td>
									<td>
										{$vo.unit_price}
									</td>
									<td>
										{$vo.discount_rate}
									</td>
									<td>
										{$vo.tax_rate}
									</td>
									<td>
										{$vo.subtotal}
									</td>
									<td>
										{$vo.description}
									</td>
								</tr>
							</volist>
						</tbody>
						<tbody id="add_products">
						</tbody>
						<tbody>
							<tr style="background-color:#FFFFF3;color:#808080">
								<td>合计</td>
								<td style="text-align:center" id="total_amount_val">{$total_amount}</td>
								<td></td>
								<td></td>
								<td></td>
								<td style="text-align:center" id="subtotal_val" colspan="2">{$vo.subtotal_val}</td>
							</tr>
							<tr style="background-color:#FFFFF1">
								<td>其他费用</td>
								<td style="text-align:center">{$vo.discount_price}</td>
								<td></td>
								<td></td>
								<td>最终费用</td>
								<td  style="text-align:center" colspan="2">{$vo.sales_price}</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
			<div class="tab-pane fade back_box" id="tab8">
				<div class="header1">
					<div class="pull-left two-title" >{:L('PROMOTE_THE_HISTORY')}</div>
					<div style="clear:both;"></div>
				</div>
				<table class="table table-hover">
					<if condition="$business.bsList eq null">
						<tr>
							<th>{:L('THERE_IS_NO_DATA')}</th>
						</tr>
					<else />
					<thead>
						<tr>
							<th>{:L('TIME')}</th>
							<th>{:L('PHASE')}</th>								
							<th>{:L('STAGE_OF_DESCRIPTION')}</th>
							<th>{:L('PRINCIPAL')}</th>
						</tr>
					</thead>
					<tbody>
						<volist name="business.bsList" id="vo">
						<tr>
							<td width="15%">
								<if condition="$vo['update_time'] neq 0">
									{$vo.update_time|date="Y-m-d H:i",###}
								<else />
									{$business.create_time|date='Y-m-d H:i',###}</if>
							</td>
							<td>{$vo.status_name}</td>
							<td>{$vo.description}</td>
							<td><notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty></td>
						</tr>
						</volist>
					</tbody>
					</if>
				</table>
			</div>
			<div class="tab-pane fade back_box" id="tab3">
				<div class="header1">
					<div class="pull-left two-title" >{:L('COMMUNICATION_LOGS')}</div>
					<div class="pull-right"> <if condition="$business['is_deleted'] neq 1">
						<a href="javascript:void(0);" class="add_log btn btn-primary">{:L('ADD')}</a>
					</if>
					</div>
					<div style="clear:both;"></div>
				</div>
				<table class="table table-hover">
					<if condition="$business.log eq null">
						<div>
							{:L('THERE_IS_NO_DATA')}
						</div>
					<else />
						<volist name="business.log" id="vo">
							<div class="caption">
								 {$vo.subject}
							</div>
							<div class="mar-left2">
								<if condition="strlen($vo['content']) gt 100">
									<div id="slog_{$vo.log_id}" class="pad-right3">
									{$vo.content|msubstr=###,0,100}
									<a class="more" rel="{$vo.log_id}" href="javascript:void(0)">{:L('READ_MORE')}</a>
									</div>
									<div id="llog_{$vo.log_id}" class="hide ">
										<div class="pad-right3 pres" >{$vo.content}</div>
									</div>
								<else/>
									<div class="pad-right3 pres" >{$vo.content}</div>
								</if>
							</div>
							<div class="editors">
								<if condition="$business['is_deleted'] neq 1"><a href="javascript:void(0)" rel="{$vo.log_id}" class="edit_log">{:L('COMPILE')}</a>&nbsp; <a href="{:U('log/delete','r=RBusinessLog&id='.$vo['log_id'])}" class="del_confirm">{:L('DELETE')}</a></if>&nbsp;&nbsp;&nbsp;
								<notempty name="vo.owner.user_name">
									<img style="margin-top:-3px;" src="__PUBLIC__/img/user.png">&nbsp;
									<a class="role_info name-colors" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a>	</notempty> &nbsp; 
								<img src="__PUBLIC__/img/time_annoce.png"/>&nbsp;<span class="name-colors name-colors" >{$vo.create_date|date="Y-m-d  g:i:s a",###}</span> &nbsp; 
								<notempty name="vo.create_date"> &nbsp; </notempty>
								<if condition="C('ismobile') eq 1"><br/></if>
							</div>
						</volist>
					</if>
				</table>
			</div>
			<div class="tab-pane fade back_box" id="tab7">
				<div class="header1">
					<div class="pull-left two-title" >{:L('THE_RELEVANT_CONTRACT')}</div>
					<div class="pull-right"> 
					<if condition="$business['is_deleted'] == 0">
						<a href="javascript:void(0);" class="btn btn-primary add_contract">{:L('ADD')}</a>
					</if>
					</div>
					<div style="clear:both;"></div>
				</div>
				<table class="table table-hover">
					<if condition="$business.contract eq null">
						<tr>
							<td>{:L('THERE_IS_NO_DATA')}</td>
						</tr>
					<else /> 
						<tr>
							<td width="10%">&nbsp;</td>
							<td>{:L('CONTRACT_NO')}</td>
							<td>{:L('SIGNING_TIME')}</td>
							<td>{:L('OFFER')}</td>
							<td>{:L('PRINCIPAL')}</td>
							<td>{:L('CREATION_TIME')}</td>
						</tr>
						<volist name="business.contract" id="vo">
							<tr>
								<td class="tdleft"><if condition="$business['is_deleted'] == 0"><a  href="{:U('contract/view','id='.$vo['contract_id'])}">{:L('CHECK')}</a> &nbsp; <a href="{:U('contract/edit','id='.$vo['contract_id'])}">{:L('COMPILE')}</a></if></td>
								<td>
									<a href="{:U('contract/view','id='.$vo['contract_id'])}">{$vo.number}</a>
								</td>									
								<td><notempty name="vo.due_time">{$vo.due_time|date="Y-m-d",###}</notempty></td>
								<td>
									{$vo.price}
								</td>
								<td>
									<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty>
								</td>
								<td><notempty name="vo.create_time">{$vo.create_time|date="Y-m-d",###}</notempty></td>
							</tr>
						</volist>
					</if>
				</table>
			</div>
			<!-- 产品 -->
			<!-- <div class="tab-pane fade back_box" id="tab2">
				<div class="header1">
					<div class="pull-left two-title" >{:L('RELATED_PRODUCTS')}</div>
					<div class="pull-right"> 
					<if condition="$business['is_deleted'] == 0">
						<a href="javascript:void(0);" class="btn btn-primary add_product">{:L('ADD')}</a>
					</if>
					</div>
					<div style="clear:both;"></div>
				</div>
				<table class="table">
					<if condition="$business.product eq null">
						<tr>
							<td>{:L('THERE_IS_NO_DATA')} </td>
						</tr>
					<else /> 
						<thead>
							<tr>
								<td>&nbsp;</td>
								<td>{:L('PRODUCT_NAME')}</td>
								<if condition="C('ismobile') neq 1">
								<td>{:L('PRODUCT_CATEGORY')}</td>
								<td>{:L('OFFER')}({:L('YUAN')})</td>
								</if>
								<td>{:L('TRADING')}({:L('YUAN')})</td>
								<td>{:L('THE_COST_PRICE')}({:L('YUAN')})</td>
								<if condition="C('ismobile') neq 1">
								<td width="30%">{:L('REMARK')}</td>
								</if>
							</tr>
						</thead>
						<tbody>
							<volist name="business.product" id="vo">
								<tr>
									<td class="tdleft">
									<if condition="$business['is_deleted'] == 0">
									<a href="{:U('product/mdelete', 'r=rBusinessProduct&id='.$vo['id'])}" class="del_confirm">{:L('DELETE')}</a>&nbsp;<a class="edit_product" href="javascript:void(0)" rel="{$vo.id}">{:L('COMPILE')}</a></if></td>
									<td>
										<a href="{:U('product/view', 'id='.$vo['product_id'])}">{$vo.info.name}</a>
									</td>
									<if condition="C('ismobile') neq 1">
									<td>
										{$vo.category_name}
									</td>
									<td>
										<if condition="$vo['estimate_price'] gt 0">{$vo.estimate_price}</if>
									</td>
									</if>
									<td>
										<if condition="$vo['sales_price'] gt 0">{$vo.sales_price}</if>
									</td>
									<td>
										<if condition="$vo['info']['cost_price'] gt 0">{$vo.info.cost_price}</if>
									</td>
									<if condition="C('ismobile') neq 1">
									<td>
										{$vo.description}
									</td>
									</if>
								</tr>
							</volist>
						</tbody>
					</if>
				</table>
			</div> -->
			<div class="tab-pane fade back_box" id="tab4">
				<div class="header1">
					<div class="pull-left two-title" >{:L('RELATED_TASKS')}</div>
					<div class="pull-right"> 
					<if condition="$business['is_deleted'] == 0">
						<a href="javascript:void(0);" class="btn btn-primary add_task">{:L('ADD')}</a>
					</if>
					</div>
					<div style="clear:both;"></div>
				</div>
				<table class="table">
					<if condition="$business.task eq null">
						<tr>
							<td>{:L('THERE_IS_NO_DATA')} </td>
						</tr>
					<else /> 
						<tr>
							<td>&nbsp;</td>
							<td>{:L('THEME')}</td>
							<td>{:L('STATE')}</td>
							<td>负责人</td>
							<td>任务相关人</td>
							<td>{:L('DUE_DATE')}</td>
							<td>{:L('MODIFICATION_TIME')}</td>
						</tr>
						<volist name="business.task" id="vo">
							<tr>
								<td class="tdleft" width="10%">
									<if condition="$business['is_deleted'] == 0"><a href="{:U('task/view','id='.$vo['task_id'])}">{:L('CHECK')}</a>&nbsp; <a href="{:U('task/delete','id='.$vo['task_id'])}" class="del_confirm">{:L('DELETE')}</a>&nbsp;
									<if condition="$vo.isclose eq 1"><a href="{:U('task/open','id='.$vo['task_id'])}">{:L('OPEN')}</a><else /><a href="{:U('task/close','id='.$vo['task_id'])}">{:L('CLOSE')}</a></if>
									</if>
								</td>
								<td>
									{$vo.subject}
								</td>
								<td>
									{$vo.status}
								</td>
								<td>
									<notempty name="vo.owner"><volist name="vo.owner" id="v"><a class="role_info" rel="{$v.role_id}" href="javascript:void(0)">{$v.user_name}</a>,</volist></notempty>
								</td>
								<td>
									<notempty name="vo.about_roles"><volist name="vo.about_roles" id="v"><a class="role_info" rel="{$v.role_id}" href="javascript:void(0)">{$v.user_name}</a>,</volist></notempty>
								</td>
								<td>
									<notempty name="vo.due_date">{$vo.due_date|date="Y-m-d g:i:s a",###}</notempty>
								</td>
								<td>
									<notempty name="vo.update_date">{$vo.update_date|date="Y-m-d g:i:s a",###}</notempty>
								</td>
							</tr>
						</volist>
					</if>
				</table>
			</div>
			<div class="tab-pane fade back_box" id="tab5">
				<div class="header1">
					<div class="pull-left two-title" >{:L('RELATED_SCHEDULE')}</div>
					<div class="pull-right"> 
					<if condition="$business['is_deleted'] == 0">
						<a href="javascript:void(0);" class="btn btn-primary add_event">{:L('ADD')}</a>
					</if>
					</div>
					<div style="clear:both;"></div>
				</div>
				<table class="table">
					<if condition="$business.event eq null">
						<tr>
							<td>{:L('THERE_IS_NO_DATA')} </td>
						</tr>
					<else /> 
						<tr>
							<td width="12%">&nbsp;</td>
							<td>{:L('THEME')}</td>
							<td>{:L('SITE')}</td>
							<td>{:L('PRINCIPAL')}</td>
							<td>{:L('THE_START_TIME')}</td>
							<td>{:L('THE_END_TIME')}</td>
						</tr>
						<volist name="business.event" id="vo">
							<tr>
								<td class="tdleft" width="10%">
									<if condition="$business['is_deleted'] == 0">
									<a href="{:U('event/view', 'id='.$vo['event_id'])}">{:L('CHECK')}</a>&nbsp; <a href="{:U('event/delete', 'id='.$vo['event_id'])}" class="del_confirm">{:L('DELETE')}</a>&nbsp; 
									<if condition="$vo['isclose'] eq 0"><a href="{:U('event/close', 'id='.$vo['event_id'])}">{:L('CLOSE')}</a><else/><a href="{:U('event/open','id='.$vo['event_id'])}">{:L('OPEN')}</a></if>
									</if>
								</td>
								<td>
									{$vo.subject}
								</td>
								<td>
									{$vo.venue}
								</td>
								<td>
									<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty>
								</td>
								<td>
									<notempty name="vo.start_date">{$vo.start_date|date="Y-m-d g:i:s a",###}</notempty>
								</td>
								<td>
									<notempty name="vo.end_date">{$vo.end_date|date="Y-m-d g:i:s a",###}</notempty>
								</td>
							</tr>
						</volist>
					</if>
				</table>
			</div>
			<div class="tab-pane fade back_box" id="tab6">
				<div class="header1">
					<div class="pull-left two-title" >{:L('THE_RELEVANT_DOCUMENTS')}</div>
					<div class="pull-right"> 
					<if condition="$business['is_deleted'] == 0">
						<a href="javascript:void(0);" class="btn btn-primary add_file">{:L('ADD')}</a>
					</if>
					</div>
					<div style="clear:both;"></div>
				</div>
				<table class="table table-hover">
					<if condition="$business.file eq null">
						<tr>
							<td>{:L('THERE_IS_NO_DATA')} </td>
						</tr>
					<else /> 
						<tr>
							<td>&nbsp;</td>
							<td>{:L('FILENAME')}</td>
							<td>{:L('SIZE')}</td>
							<td>{:L('ADDER')}</td>
							<td>{:L('ADDTIME')}</td>
						</tr>
						<volist name="business.file" id="vo">
							<tr>
								<td class="tdleft">
									<if condition="$business['is_deleted'] == 0">
										<a href="{:U('file/delete', 'r=RBusinessFile&id='.$vo['file_id'])}" class="del_confirm">{:L('DELETE')}</a>
									</if>
								</td>
								<td>
									<a target="_blank" href="{$vo.file_path}">{$vo.name}</a>
								</td>
								<td>
									{$vo.size}{:L('BYTE')}
								</td>
								<td>
									<notempty name="vo.owner.user_name"><a class="role_info" rel="{$vo.owner.role_id}" href="javascript:void(0)">{$vo.owner.user_name}</a></notempty>
								</td>
								<td>
									<notempty name="vo.create_date">{$vo.create_date|date="Y-m-d g:i:s a",###}</notempty>
								</td>
							</tr>
						</volist>
					</if>
				</table>
			</div>
		</div>
		<div class="span2 bs-docs-sidebar mar-lefts2" id="right_list" >
			<ul class="nav nav-list bs-docs-sidenav  span2 widths" >
				<li class="first-li"><span class="spans1">编辑详情</span></li>
				<li><a href="javascript:void(0);" class="advance"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('BOOST')}</a></li>
				<li><a href="javascript:void(0);" class="add_product"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('ADD_PRODUCT')}</a></li>
				<li><a href="javascript:void(0);" class="add_log"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('ADD_THE_COMMUNICATION_LOG')}</a></li>
				<li><a href="javascript:void(0);" class="add_task"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('ADD_TASKS')}</a></li>
				<li><a href="javascript:void(0);" class="add_event"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('ADD_THE_SCHEDULE')}</a></li>
				<li><a href="javascript:void(0);" class="add_file"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('ADD_ATTACHMENT')}</a></li>
			</ul>
		</div>
	</div>
</div>
<div class="hide" id="dialog-file" title="{:L('ADD_ATTACHMENT')}">loading...</div>
<div class="hide" id="dialog-log" title="{:L('ADD_THE_LOG')}">loading...</div>
<div class="hide" id="dialog-log-edit" title="{:L('EDIT_LOG')}">loading...</div>
<div class="hide" id="dialog-task" title="{:L('ADD_TASKS')}">loading...</div>
<div class="hide" id="dialog-event" title="{:L('ADD_THE_SCHEDULE')}">loading...</div>
<div class="hide" id="dialog-product" title="{:L('ADD_PRODUCT')}">loading...</div>
<div class="hide" id="dialog-edit" title="{:L('MODIFY_BUSINESS_PRODUCT_INFORMATION')}">loading...
<div class="hide" id="dialog-role-info" title="{:L('Employee_information')}">loading...</div>
<div class="hide" id="dialog-contract" title="{:L('ADD_THE_CONTRACT')}">loading...</div>
<div class="hide" id="dialog-advance" title="{:L('OPPORTUNITIES_TO_ADVANCE')}">loading...</div>
<script type="text/javascript">
	$('#left_list a').click(function (e) {
        e.preventDefault();
        $('#right_list').hide();
        $('#left_list').parent().next().removeClass('span8').addClass('span10');
        $(this).tab('show');
    })
    $('#left_list a:first').on('click', function (e) {
        $('#left_list').parent().next().removeClass('span10').addClass('span8');
        $('#right_list').show();
    })
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>

$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-advance").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-contract").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-file").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-log").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-task").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	position: ["center",100]
});
$("#dialog-event").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-log-edit").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-product").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$("#dialog-edit").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight:400,
	position: ["center",100]
});
$(".add_file").click(function(){
	$('#dialog-file').dialog('open');
	$('#dialog-file').load('{:U("file/add", "r=RBusinessFile&module=business&id=".$business["business_id"])}');
});
$(".add_log").click(function(){
	$('#dialog-log').dialog('open');
	$('#dialog-log').load('{:U("log/add", "r=RBusinessLog&module=business&id=".$business["business_id"])}');
});
$(".edit_log").click(function(){
	$log_id = $(this).attr('rel');
	$('#dialog-log-edit').dialog('open');
	$('#dialog-log-edit').load('{:U("log/edit","id=")}'+$log_id);
});
$(".add_task").click(function(){
	$('#dialog-task').dialog('open');
	$('#dialog-task').load('{:U("task/add","r=RBusinessTask&module=business&id=".$business["business_id"])}');
});
$(".add_event").click(function(){
	$('#dialog-event').dialog('open');
	$('#dialog-event').load('{:U("event/add","r=RBusinessEvent&module=business&id=".$business["business_id"])}');
});
$(".add_product").click(function(){
	$('#dialog-product').dialog('open');
	$('#dialog-product').load('{:U("product/adddialog","r=RBusinessProduct&module=business&id=".$business["business_id"])}');
});
$(".edit_product").click(function(){
	id = $(this).attr('rel');
	$('#dialog-edit').dialog('open');
	$('#dialog-edit').load('{:U("product/editdialog","r=RBusinessProduct&id")}'+id);
});
$(".role_info").click(function(){
	$role_id = $(this).attr('rel');
	$('#dialog-role-info').dialog('open');
	$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
});
$(".add_contract").click(function(){
	$('#dialog-contract').dialog('open');
	$('#dialog-contract').load('{:U("contract/add","business_id=")}'+{$business.business_id});
});
$(".advance").click(function(){
	$('#dialog-advance').dialog('open');
	$('#dialog-advance').load('{:U("business/advance","id=".$business["business_id"])}');
});
$(".more").click(function(){
	log_id = $(this).attr('rel');
	$('#llog_'+log_id).attr('class','');
	$('#slog_'+log_id).attr('class','hide');
});
</script>
<include file="Public:footer" />	